const Mock = require('mockjs');

let listData = {
    "info": {
        "flag": "",
        "indexPage": 1,
        "pageCount": 1,
        "rows": [
            {
                "code": "3",
                "createtime": "2019-09-2615:55:56",
                "description": "3",
                "guid": "3",
                "guids": [],
                "likeCode": "",
                "manager": "3",
                "managertel": "3",
                "name": "3",
                "operatorid": "3",
                "orgGuid": "",
                "orgName": "",
                "orgguid": "3",
                "remark": "3"
            },
            {
                "code": "2",
                "createtime": "2019-09-1115:55:47",
                "description": "2",
                "guid": "2",
                "guids": [],
                "likeCode": "",
                "manager": "2",
                "managertel": "2",
                "name": "2",
                "operatorid": "2",
                "orgGuid": "",
                "orgName": "",
                "orgguid": "2",
                "remark": "2"
            },
            {
                "code": "1",
                "createtime": "2019-09-0315:55:36",
                "description": "1",
                "guid": "1",
                "guids": [],
                "likeCode": "",
                "manager": "1",
                "managertel": "1",
                "name": "1",
                "operatorid": "1",
                "orgGuid": "",
                "orgName": "",
                "orgguid": "1",
                "remark": "1"
            }
        ],
        "total": 3
    }
}

let oneData = {
    "info": {
        "code": "1",
        "createtime": "2019-09-0315:55:36",
        "description": "1",
        "guid": "1",
        "guids": [],
        "likeCode": "",
        "manager": "1",
        "managertel": "1",
        "name": "1",
        "operatorid": "1",
        "orgGuid": "",
        "orgName": "",
        "orgguid": "1",
        "remark": "1"
    }
};

function postOne(req, res) {
    const { type, body } = req;

    return {"info": "ok"};
}

//格式： Mock.mock( url, post/get , 返回的数据)；
Mock.mock('/api/department', 'post', listData);
Mock.mock('/api/department/add', 'post', postOne);
Mock.mock('/api/department/edit', 'post', oneData);
Mock.mock('/api/department/del', 'post', postOne);


